<?
if (isset($row0) || isset($row1)):
    $displayed = array();
    foreach ($row0->result() as $rows):
        $displayed[$rows->file_name] = 1;
        ?>
    <div>
        <h2 class="search_result_title">
            <a href="<?=site_url('index/show_file/1/' . $rows->file_id . '?url=' . $rows->file_dir)?>">
                <?=$rows->file_name?>
            </a>
        </h2>

        <p class="search_result_content"><?=$rows->file_keyword?></p>

        <p class="search_result_content"><?=$rows->file_keyword_auto?></p>

        <div style="float:left;margin-right:10px;border:thin #add8e6 solid;padding:0 5px;">
            Author: <?=$rows->file_owner_username?></div>
        <div style="float:left;margin-right:10px;border:thin #add8e6 solid;padding:0 5px;">
            Date: <?=$rows->file_last_update?></div>
        <div style="float:left;margin-right:10px;border:thin #add8e6 solid;padding:0 5px;">
            Views: <?=$rows->file_visted?></div>
        <div style="float:left;margin-right:10px;border:thin #add8e6 solid;padding:0 5px;">
            <a href="<?=site_url('index/submit_complain/' . $rows->file_name . '/' . $rows->file_owner_username)?>"
               target="_blank">
                Submit Complains
            </a>
        </div>
        <br/>
    </div>
    <?
    endforeach;
    //Result 2.
    foreach ($row1->result() as $rows):
        if (!isset($displayed[$rows->file_name])):
            ?>
        <div>
            <h2 class="search_result_title">
                <a href="<?=site_url('index/show_file/1/' . $rows->file_id . '?url=' . $rows->file_dir)?>">
                    <?=$rows->file_name?>
                </a>
            </h2>

            <p class="search_result_content"><?=$rows->file_keyword?></p>

            <p class="search_result_content"><?=$rows->file_keyword_auto?></p>

            <div style="float:left;margin-right:10px;border:thin #add8e6 solid;padding:0 5px;">
                Author: <?=$rows->file_owner_username?></div>
            <div style="float:left;margin-right:10px;border:thin #add8e6 solid;padding:0 5px;">
                Date: <?=$rows->file_last_update?></div>
            <div style="float:left;margin-right:10px;border:thin #add8e6 solid;padding:0 5px;">
                Views: <?=$rows->file_visted?></div>
            <div style="float:left;margin-right:10px;border:thin #add8e6 solid;padding:0 5px;">
                <a href="<?=site_url('index/submit_complain/' . $rows->file_name)?>">
                    Submit Complains
                </a>
            </div>
            <br/>
        </div>
        <?
        endif;
    endforeach;
else:
    echo 'NO Result Found!';
endif;
?>